home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Source Code / C / Applications / µSim 1.1 / source / SimAsm.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-25  |  2.8 KB  |  140 lines  |  [TEXT/CWIE]

  1. /*
  2. Copyright © 1993-1997 Fabrizio Oddone
  3. ••• ••• ••• ••• ••• ••• ••• ••• ••• •••
  4. This source code is distributed as freeware:
  5. you may copy, exchange, modify this code.
  6. You may include this code in any kind of application: freeware,
  7. shareware, or commercial, provided that full credits are given.
  8. You may not sell or distribute this code for profit.
  9. */
  10.  
  11. #include    "UtilsSys7.h"
  12.  
  13. #include    "Globals.h"
  14. #include    "ControlStore.h"
  15. #include    "Microprogram_Ed.h"
  16. #include    "SimAsm.h"
  17.  
  18.  
  19. Boolean instrClikLoop(void)
  20. {
  21. Rect tempRect = *keyrects[kKEY_LIST];
  22. Point    tempPt;
  23.  
  24. tempRect.right -= kScrollbarAdjust;
  25. GetMouse(&tempPt);
  26. draggedOnComments = PtInRect(tempPt, &tempRect);
  27.  
  28. #if GENERATINGCFM
  29. return draggedOnComments;
  30. #else
  31. return draggedOnComments == false;
  32. #endif
  33. }
  34.  
  35. Boolean commentClikLoop(void)
  36. {
  37. union u_mir tmpmir;
  38. Rect    clkRect, destRect;
  39. Point    curPt;
  40. short    cellMid, temp;
  41.  
  42. curPt = LLastClick(Lists[kL_COMMENTS]);
  43. tmpmir = *(gCsMemory + curPt.v);
  44. if (tmpmir.bits.cond) {
  45.     LRect(&clkRect, curPt, Lists[kL_COMMENTS]);
  46.     GetMouse(&curPt);
  47.     if (PtInRect(curPt, &clkRect)) {
  48.         if (arrowDrawn == false) {
  49.             cellMid = (clkRect.top + clkRect.bottom) >> 1;
  50.             temp = clkRect.left - klateralCellTweek;
  51.             MoveTo(temp, cellMid);
  52.             temp -= karrowDistFromList;
  53.             LineTo(temp, cellMid);
  54.             curPt.h = 0;
  55.             curPt.v = tmpmir.bits.addr;
  56.             LRect(&destRect, curPt, Lists[kL_COMMENTS]);
  57.             cellMid = (destRect.top + destRect.bottom) >> 1;
  58.             LineTo(temp, cellMid);
  59.             temp += karrowDistFromList;
  60.             LineTo(temp, cellMid);
  61.             LineTo(temp, cellMid);
  62.             LineTo(temp - karrowHead, cellMid - karrowHead);
  63.             MoveTo(temp, cellMid);
  64.             LineTo(temp - karrowHead, cellMid + karrowHead);
  65.             arrowDrawn = true;
  66.             }
  67.         }
  68.     else if (arrowDrawn) {
  69.         EraseArrowRect();
  70. //        UnloadSeg(EraseArrowRect);
  71.         }
  72.     }
  73. return kListClickLoopTrue;
  74. }
  75.  
  76. #if defined(powerc) || defined (__powerc)
  77.  
  78. Boolean switchCursClikLoop(void)
  79. {
  80. Rect tempRect = *keyrects[kKEY_LIST];
  81. Point    tempPt;
  82. Boolean d7;
  83.  
  84. tempRect.right -= kScrollbarAdjust;
  85. GetMouse(&tempPt);
  86. d7 = PtInRect(tempPt, &tempRect);
  87. if (d7 != draggedOnComments) {
  88.     SetCursor(d7 ? *GetCursor(kSheetsCursor) : &qd.arrow);
  89.     draggedOnComments = d7;
  90.     }
  91.  
  92. return kListClickLoopTrue;
  93. }
  94.  
  95. #else
  96.  
  97. asm Boolean switchCursClikLoop(void)
  98. {
  99.     LINK    A6,#-8
  100.     MOVEA.L    keyrects+(kKEY_LIST*4),A0
  101.     LEA        -8(A6),A1
  102.     MOVE.L    (A0)+,(A1)+
  103.     MOVE.L    (A0),(A1)+
  104.     SUBI.W    #kScrollbarAdjust,-(A1)
  105.  
  106.     MOVE.L    D7,-(SP)
  107.     SUBQ.L    #2,SP
  108.     MOVE.L    D5,-(SP)    // we must not overwrite D5 (contains mouse location)
  109.     PEA        -8(A6)
  110.     _PtInRect
  111.     MOVE.B    (SP)+,D7
  112.     CMP.B    draggedOnComments,D7
  113.     BEQ.S    exitasm
  114.     
  115.     TST.B    D7
  116.     BEQ.S    restoreplus
  117.     
  118.     SUBQ.L    #4,SP
  119.     MOVE.W    #kSheetsCursor,-(SP)
  120.     _GetCursor
  121.     MOVEA.L    (SP),A0
  122.     MOVE.L    (A0),(SP)
  123.     _SetCursor
  124.     BRA.S    goodexit
  125. restoreplus:
  126.     PEA        qd.arrow
  127.     _SetCursor
  128. goodexit:
  129.     MOVE.B    D7,draggedOnComments
  130. exitasm:
  131.     MOVE.L    (SP)+,D7
  132.     MOVEQ    #1,D0
  133. //    MOVE.B    D0,8(A6)    //    true    (actually not needed)!
  134.     
  135.     UNLK    A6
  136.     RTS
  137. }
  138.  
  139. #endif
  140.